﻿function getMonth(datetime) {
    var temp;
    switch (datetime) {
        case 1:
            temp = "Jan";
            break;
        case 2:
            temp = "Feb";
            break;
        case 3:
            temp = "Mar";
            break;
        case 4:
            temp = "Apr";
            break;
        case 5:
            temp = "May";
            break;
        case 6:
            temp = "Jun";
            break;
        case 7:
            temp = "Jul"; break;
        case 8:
            temp = "Aug"; break;
        case 9:
            temp = "Sep"; break;
        case 10:
            temp = "Oct"; break;
        case 11:
            temp = "Nov"; break;
        case 12:
            temp = "Dec"; break;
        default:
            temp = ""; break;
    }
    return temp;
}

function formatJSONDate(jsonDate) {
    if (jsonDate) {
        var d = new Date(parseInt(jsonDate.substr(6)));
        var curr_date = d.getDate();
        var curr_month = d.getMonth() + 1;
        var curr_year = d.getFullYear();
        return curr_date + "-" + getMonth(curr_month) + "-" + curr_year;
    }
    return "";
}